import request from '@/request/request'

// 会员信息管理API
export const memberApi = {
  // 分页查询会员信息
  list: (params) => {
    return request({
      url: '/crm/member/list',
      method: 'get',
      params
    })
  },

  // 根据ID查询会员信息
  getById: (id) => {
    return request({
      url: `/crm/member/${id}`,
      method: 'get'
    })
  },

  // 新增会员信息
  add: (data) => {
    return request({
      url: '/crm/member',
      method: 'post',
      data
    })
  },

  // 更新会员信息
  update: (data) => {
    return request({
      url: '/crm/member',
      method: 'put',
      data
    })
  },

  // 删除会员信息
  delete: (id) => {
    return request({
      url: `/crm/member/${id}`,
      method: 'delete'
    })
  },

  // 批量删除会员信息
  batchDelete: (ids) => {
    return request({
      url: '/crm/member/batch',
      method: 'delete',
      data: ids
    })
  },

  // 获取会员统计信息
  getStats: () => {
    return request({
      url: '/crm/member/stats',
      method: 'get'
    })
  }
}
